﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Sto7a01
    {
		private string _ptranid;
		private string _productid;
		private double _tranqty;
		private double _sendqty;
		private double _recqty;
		private double _tranprice;
		private double _sendamt;
		private double _tranamt;
		private double _recamt;
		private string _detailid;
		
        /// <summary>
        /// 表头标识
        /// </summary>
		public string Ptranid
		{
			get { return _ptranid;	 }
			set { _ptranid=value;	}
		}
        /// <summary>
        /// 商品标识
        /// </summary>
		public string Productid
		{
			get { return _productid;	 }
			set { _productid=value;	}
		}
        /// <summary>
        /// 调拨数量
        /// </summary>
		public double Tranqty
		{
			get { return _tranqty;	 }
			set { _tranqty=value;	}
		}
        /// <summary>
        /// 发货数量
        /// </summary>
		public double Sendqty
		{
			get { return _sendqty;	 }
			set { _sendqty=value;	}
		}
        /// <summary>
        /// 收货数量
        /// </summary>
		public double Recqty
		{
			get { return _recqty;	 }
			set { _recqty=value;	}
		}
        /// <summary>
        /// 调拨价格
        /// </summary>
		public double Tranprice
		{
			get { return _tranprice;	 }
			set { _tranprice=value;	}
		}
        /// <summary>
        /// 发货金额
        /// </summary>
		public double Sendamt
		{
			get { return _sendamt;	 }
			set { _sendamt=value;	}
		}
        /// <summary>
        /// 调拨金额
        /// </summary>
		public double Tranamt
		{
			get { return _tranamt;	 }
			set { _tranamt=value;	}
		}
        /// <summary>
        /// 收货金额
        /// </summary>
		public double Recamt
		{
			get { return _recamt;	 }
			set { _recamt=value;	}
		}
        /// <summary>
        /// 明细主键
        /// </summary>
		public string Detailid
		{
			get { return _detailid;	 }
			set { _detailid=value;	}
		}
		
		public static List<Sto7a01> GetSto7a01ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Sto7a01> list = new List<Sto7a01>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Sto7a01 model = GetSto7a01ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Sto7a01 GetSto7a01ByDataRow(DataRow dr)
		{
			Sto7a01 model = new Sto7a01(); //实例化Sto7a01
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("ptranid")&&!(dr["ptranid"] is System.DBNull))  
				model.Ptranid = ( string)dr["ptranid"];
			if (dcc.Contains("productid")&&!(dr["productid"] is System.DBNull))  
				model.Productid = ( string)dr["productid"];
			if (dcc.Contains("tranqty")&&!(dr["tranqty"] is System.DBNull))  
				model.Tranqty = Convert.ToDouble(dr["tranqty"]);
			if (dcc.Contains("sendqty")&&!(dr["sendqty"] is System.DBNull))  
				model.Sendqty = Convert.ToDouble(dr["sendqty"]);
			if (dcc.Contains("recqty")&&!(dr["recqty"] is System.DBNull))  
				model.Recqty = Convert.ToDouble(dr["recqty"]);
			if (dcc.Contains("tranprice")&&!(dr["tranprice"] is System.DBNull))  
				model.Tranprice = Convert.ToDouble(dr["tranprice"]);
			if (dcc.Contains("sendamt")&&!(dr["sendamt"] is System.DBNull))  
				model.Sendamt = Convert.ToDouble(dr["sendamt"]);
			if (dcc.Contains("tranamt")&&!(dr["tranamt"] is System.DBNull))  
				model.Tranamt = Convert.ToDouble(dr["tranamt"]);
			if (dcc.Contains("recamt")&&!(dr["recamt"] is System.DBNull))  
				model.Recamt = Convert.ToDouble(dr["recamt"]);
			if (dcc.Contains("detailid")&&!(dr["detailid"] is System.DBNull))  
				model.Detailid = ( string)dr["detailid"];
			
			return model;
		}
    }
}
